home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 27
/
CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso
/
CUCD
/
PowerPC
/
vbcc
/
machines
/
amigawos
/
libsrc
/
time
/
time.c
< prev
Wrap
C/C++ Source or Header
|
1998-08-02
|
875b
|
42 lines
/*
** vbcc-PowerOpen/WarpOS version of time.c
**
** v0.1 06.03.97 phx
*/
#include <time.h>
#include <dos/dos.h>
#include <powerpc/powerpc.h>
#include <clib/powerpc_protos.h>
extern long __gmtoffset;
extern ULONG DOSBase;
time_t time(time_t *tloc)
{
struct DateStamp t;
time_t ti;
struct PPCArgs pa;
pa.PP_Code = (APTR)DOSBase;
pa.PP_Offset = -192; /* _LVODateStamp */
pa.PP_Flags = pa.PP_StackSize = 0;
pa.PP_Stack = NULL;
pa.PP_Regs[PPREG_D1] = (ULONG)&t;
pa.PP_Regs[PPREG_A6] = (ULONG)DOSBase;
Run68k(&pa); /* Get timestamp */
ti=((t.ds_Days+2922)*1440+t.ds_Minute+__gmtoffset)*60+
t.ds_Tick/TICKS_PER_SECOND;
if(tloc!=NULL)
*tloc=ti;
return ti;
}
/*
* 2922 is the number of days between 1.1.1970 and 1.1.1978 (2 leap years and 6
normal)
* 1440 is the number of minutes per day
* 60 is the number of seconds per minute
*/